View Issue Details

IDProjectCategoryView StatusLast Update
0002652JEDI VCL00 JVCL Componentspublic2005-02-19 06:17
ReporterjegesAssigned Touser72 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version3.00 
Summary0002652: TJvSimpleXml namespace problem at end tag
DescriptionHello!

I have used this component to parse an xml file that I got from the Java
standard xml creator. I encountered a problem parsing the following types
of xml elements:

<someNamespace:MyTag>blahblah</someNamespace:MyTag>

The TJvSimpleXml component only accepts the following type of tags:
<someNamespace:MyTag>blahblah</MyTag>

IMHO the first form should be valid, based on the Java generated xmls.
TagsNo tags attached.

Activities

user72

2005-02-18 01:38

  ~0006512

It is a bug. Try commenting out the ':' case handler in TJvSimpleXMLElemClassic.LoadFromStream and see if that resolves it.

NB! Not tested extensively, so might have other, unknown, negative side-effects

2005-02-18 09:24

 

JvSimpleXml_good.pas (91,055 bytes)

jeges

2005-02-18 11:06

reporter   ~0006523

I worked on it today and it looks like I solved the problem. I attached the file to the issue. I noticed that, when creating the xml stream it doesn't adds the namespaces (called pointers in the code) also. If you find it useful and solid commit it in. Diffs:
- TJvSimpleXMLElemClassic.SaveToStream adds the (namespace + ':') characters before tagname
- TJvSimpleXMLElems.LoadFromStream saves in a local variable the namespace and when the tag is finished it returns (namespace + ':' + tagname) to TJvSimpleXMLElemClassic.LoadFromStream
- TJvSimpleXMLElemClassic.LoadFromStream validates the returned end tag namespace and tagname to the elements namespace and tagname

That's all.

PS. Sorry about the double attachment. I couldn't delete the first, which was an older "under construction" version sadly uploaded. The file containing the solution is the "JvSimpleXml_good.pas" which should be of course renamed to "JvSimpleXml.pas". If you have the rights please delete the old one :)

user72

2005-02-19 05:13

  ~0006524

Have you tested your changes with xml files that doesn't have namespace prefixed tags? I suspect not.

user72

2005-02-19 06:17

  ~0006527

A slightly modified version has been posted to CVS where the value of the prefix is checked before adding the ':'. Also includes a fix for CDATA sections that has white space between the CDATA and the last [. This is allowed.

Issue History

Date Modified Username Field Change
2005-02-17 16:30 jeges New Issue
2005-02-18 01:38 user72 Note Added: 0006512
2005-02-18 01:38 user72 Status new => feedback
2005-02-18 08:57 anonymous File Added: JvSimpleXml.pas
2005-02-18 09:24 anonymous File Added: JvSimpleXml_good.pas
2005-02-18 09:32 anonymous Note Added: 0006519
2005-02-18 11:06 anonymous Note Deleted: 0006519
2005-02-18 11:06 jeges Note Added: 0006523
2005-02-19 05:03 user72 File Deleted: JvSimpleXml.pas
2005-02-19 05:13 user72 Note Added: 0006524
2005-02-19 06:17 user72 Status feedback => resolved
2005-02-19 06:17 user72 Resolution open => fixed
2005-02-19 06:17 user72 Assigned To => user72
2005-02-19 06:17 user72 Note Added: 0006527