-
regarding xml
i have an xml file
likethis
<EMAIL>
<[email protected]>
<DT:07:06:2007>
<RED Time=11:30:46>hi</RED>
</DT:07:06:2007>
</[email protected]>
</EMAIL>
i want add elements to the <DT:..> tag
but when i parse the file ika gettinh parser error at "@",":".
so without parse how can add and retrieve the dat from xml
thank u
-
http://www.w3.org/TR/REC-xml/
Because they're not valid XML names perhaps?
-
yah
but is there anyway we can add or retreive data without parsing the document
-
Build your own non-xml parser I guess.
-
thank u for ur reply
how we can built non-xml and how can we add and retrieve our data.
-
Either you're using XML or you don't. If you use incorrect element names, you're not using XML and the whole advantage of XML is to be exploitable easily. Think about it ... either write an ENTIRE PARSER or change one friggin element name.
-
With XML you also have to quote attributes, that is,
Code:
<RED Time=11:30:46>hi</RED>
must be
Code:
<RED Time="11:30:46">hi</RED>
XML elements are also usually lowercase, but that's not required.
Anyway, it would be relatively simple to write a program which changes
Code:
<DT:07:06:2007>
</DT:07:06:2007>
into
Code:
<DT date="07:06:2007">
</DT>
In fact, here's a Perl script which will do it for you:
Code:
$ perl -pe 's/<DT:(\d\d:\d\d:\d{4,4})>/<DT date="$1">/;s|</DT[:\d]+>|</DT>|'
Sorry, couldn't resist. :)