reading from EPROM
Closed this issue · 4 comments
Hi i am reading from eeprom and i get string without any problem . but when i parse, it doesn't recognize the string .. its like this
char buffer[1024];
printf buffer :
but if i declare string in same fiuntion it works fine.
char buffer[] = "\n"............
XMLDoc doc;
XMLDoc_init(&doc);
XMLDoc_parse_buffer_DOM(buffer, "test1", &doc);
XMLNode* root;
root = doc.nodes[doc.i_root];
char* root_name = (char*)malloc(strlen(root->tag));
strcpy(root_name, root->tag);
display_recursive_children_content(root, root->n_children, root->tag);
I CAN PARSE this formate
"<?xml version='1.0' encoding='utf-8'?>\n"
"<UANodeSet xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:uax=\"http://opcfoundation.org/UA/2008/02/Types.xsd\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns=\"http://opcfoundation.org/UA/2011/03/UANodeSet.xsd\">\n"
" <NamespaceUris>\n"
" <Uri>http://audit.de</Uri>\n"
" </NamespaceUris>\n"
" <Aliases>\n"
" <Alias Alias=\"Int32\">i=6</Alias>\n"
" <Alias Alias=\"Float\">i=10</Alias>\n"
" <Alias Alias=\"Organizes\">i=35</Alias>\n"
" <Alias Alias=\"HasTypeDefinition\">i=40</Alias>\n"
" <Alias Alias=\"HasComponent\">i=47</Alias>\n"
" </Aliases>\n"
" <UAObject NodeId=\"i=20001\" BrowseName=\"0:powerSetup\" ParentNodeId=\"i=85\">\n"
" <DisplayName>powerSetup</DisplayName>\n"
" <References>\n"
" <Reference ReferenceType=\"Organizes\" IsForward=\"false\">i=85</Reference>\n"
" <Reference ReferenceType=\"HasTypeDefinition\">i=58</Reference>\n"
" <Reference ReferenceType=\"HasComponent\">i=20002</Reference>\n"
" <Reference ReferenceType=\"HasComponent\">i=20003</Reference>\n"
" </References>\n"
" </UAObject>\n"
" <UAVariable NodeId=\"i=20002\" BrowseName=\"0:minPower\" ParentNodeId=\"i=20001\" DataType=\"Int32\">\n"
" <DisplayName>minPower</DisplayName>\n"
" <Description>minPower</Description>\n"
" <References>\n"
" <Reference ReferenceType=\"HasComponent\" IsForward=\"false\">i=20001</Reference>\n"
" <Reference ReferenceType=\"HasTypeDefinition\">i=63</Reference>\n"
" </References>\n"
" <Value>\n"
" <uax:Int32>0</uax:Int32>\n"
" </Value>\n"
" </UAVariable>\n"
" <UAVariable NodeId=\"i=20003\" BrowseName=\"0:maxPower\" ParentNodeId=\"i=20001\" DataType=\"Float\">\n"
" <DisplayName>maxPower</DisplayName>\n"
" <Description>maxPower</Description>\n"
" <References>\n"
" <Reference ReferenceType=\"HasComponent\" IsForward=\"false\">i=20001</Reference>\n"
" <Reference ReferenceType=\"HasTypeDefinition\">i=63</Reference>\n"
" </References>\n"
" <Value>\n"
" <uax:Float>0.0</uax:Float>\n"
" </Value>\n"
" </UAVariable>\n"
"</UANodeSet>";
but not this one .. both are same only 1 in string and declare in fucntion and other i read from ROM
<?xml version='1.0' encoding='utf-8'?>
<UANodeSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:uax="http://opcfoundation.org/UA/2008/02/Types.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://opcfoundation.org/UA/2011/03/UANodeSet.xsd">
<NamespaceUris>
<Uri>http://audit.de</Uri>
</NamespaceUris>
<Aliases>
<Alias Alias="Int32">i=6</Alias>
<Alias Alias="Float">i=10</Alias>
<Alias Alias="Organizes">i=35</Alias>
<Alias Alias="HasTypeDefinition">i=40</Alias>
<Alias Alias="HasComponent">i=47</Alias>
</Aliases>
<UAObject NodeId="i=20001" BrowseName="0:powerSetup" ParentNodeId="i=85">
<DisplayName>powerSetup</DisplayName>
<References>
<Reference ReferenceType="Organizes" IsForward="false">i=85</Reference>
<Reference ReferenceType="HasTypeDefinition">i=58</Reference>
<Reference ReferenceType="HasComponent">i=20002</Reference>
<Reference ReferenceType="HasComponent">i=20003</Reference>
</References>
</UAObject>
<UAVariable NodeId="i=20002" BrowseName="0:minPower" ParentNodeId="i=20001" DataType="Int32">
<DisplayName>minPower</DisplayName>
<Description>minPower</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">i=20001</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
<Value>
<uax:Int32>0</uax:Int32>
</Value>
</UAVariable>
<UAVariable NodeId="i=20003" BrowseName="0:maxPower" ParentNodeId="i=20001" DataType="Float">
<DisplayName>maxPower</DisplayName>
<Description>maxPower</Description>
<References>
<Reference ReferenceType="HasComponent" IsForward="false">i=20001</Reference>
<Reference ReferenceType="HasTypeDefinition">i=63</Reference>
</References>
<Value>
<uax:Float>0.0</uax:Float>
</Value>
</UAVariable>
</UANodeSet>
Hello again...
Please, use the code formatting buttons so I can see the actual characters. If you read you comment before my edit you'll see that the XML you copy-pasted wasn't displayed properly.
Also, please include the full code you use to parse the problematic buffer (including the buffer itself) so I can see if the error you noticed is from the code or an unusual XML format (or it might as well not be an error at all).
Closing for no update.