Revision 9507 trunk/libraries/libRemoteServices/src/org/gvsig/remoteClient/gml/schemas/XMLSchemaParser.java
XMLSchemaParser.java | ||
---|---|---|
64 | 64 |
* |
65 | 65 |
* $Id$ |
66 | 66 |
* $Log$ |
67 |
* Revision 1.5 2006-12-22 11:25:44 csanchez |
|
67 |
* Revision 1.6 2006-12-29 17:15:48 jorpiell |
|
68 |
* Se tienen en cuenta los simpleTypes y los choices, adem?s de los atributos multiples |
|
69 |
* |
|
70 |
* Revision 1.5 2006/12/22 11:25:44 csanchez |
|
68 | 71 |
* Nuevo parser GML 2.x para gml's sin esquema |
69 | 72 |
* |
70 | 73 |
* Revision 1.4 2006/10/10 12:52:28 jorpiell |
... | ... | |
349 | 352 |
* Etiqueta <simpleType> * |
350 | 353 |
****************************/ |
351 | 354 |
// SIMPLE TYPE elements like enumarations not implemented |
352 |
|
|
355 |
else if (getName().compareTo(CapabilitiesTags.SIMPLETYPE)==0){ |
|
356 |
parseSimpleType(); |
|
357 |
} |
|
353 | 358 |
/************************ |
354 | 359 |
* Etiqueta <element> * |
355 | 360 |
************************/ |
... | ... | |
391 | 396 |
return 0; |
392 | 397 |
} |
393 | 398 |
|
399 |
private void parseSimpleType() throws IOException, XmlPullParserException{ |
|
400 |
int currentTag; |
|
401 |
boolean end = false; |
|
402 |
currentTag = getEventType(); |
|
403 |
|
|
404 |
String typeName = null; |
|
405 |
String typeValue = null; |
|
406 |
|
|
407 |
for (int i=0 ; i<getAttributeCount() ; i++){ |
|
408 |
if (getAttributeName(i).compareTo(CapabilitiesTags.ELEMENT_NAME) == 0){ |
|
409 |
typeName = getAttributeValue(i); |
|
410 |
} |
|
411 |
} |
|
412 |
|
|
413 |
while (!end){ |
|
414 |
switch(currentTag){ |
|
415 |
case KXmlParser.START_TAG: |
|
416 |
if (getName().compareTo(CapabilitiesTags.RESTRICTION)==0){ |
|
417 |
for (int i=0 ; i<getAttributeCount() ; i++){ |
|
418 |
if (getAttributeName(i).compareTo(CapabilitiesTags.BASE) == 0){ |
|
419 |
typeValue = getAttributeValue(i); |
|
420 |
} |
|
421 |
} |
|
422 |
} |
|
423 |
//Falta parsear los tipos enumerados |
|
424 |
break; |
|
425 |
case KXmlParser.END_TAG: |
|
426 |
if (getName().compareTo(CapabilitiesTags.SIMPLETYPE) == 0) |
|
427 |
end = true; |
|
428 |
break; |
|
429 |
case KXmlParser.TEXT: |
|
430 |
break; |
|
431 |
} |
|
432 |
if (!end){ |
|
433 |
currentTag = next(); |
|
434 |
} |
|
435 |
} |
|
436 |
if ((typeName != null) && (typeValue != null)){ |
|
437 |
XMLTypesFactory.addSimpleType(typeName,typeValue); |
|
438 |
} |
|
439 |
} |
|
440 |
|
|
441 |
|
|
442 |
|
|
394 | 443 |
/************************************************************************************ |
395 | 444 |
* FUNCION PARSE COMPLEX TYPE(COMPLEX TYPE) * |
396 | 445 |
* * |
... | ... | |
424 | 473 |
else if(getName().compareTo(CapabilitiesTags.SEQUENCE)==0){ |
425 | 474 |
parseSequence(complexType); |
426 | 475 |
} |
476 |
/************************ |
|
477 |
* Etiqueta <choice> * |
|
478 |
************************/ |
|
479 |
else if(getName().compareTo(CapabilitiesTags.CHOICE)==0){ |
|
480 |
parseChoice(complexType); |
|
481 |
} |
|
427 | 482 |
break; |
428 | 483 |
case KXmlParser.END_TAG: |
429 | 484 |
if (getName().compareTo(CapabilitiesTags.COMPLEXTYPE) == 0) |
... | ... | |
569 | 624 |
} |
570 | 625 |
} |
571 | 626 |
|
627 |
private void parseChoice(XMLComplexType complexType) throws IOException, XmlPullParserException |
|
628 |
{ |
|
629 |
int currentTag; |
|
630 |
boolean end = false; |
|
631 |
|
|
632 |
require(KXmlParser.START_TAG, null, CapabilitiesTags.CHOICE); |
|
633 |
currentTag = next(); |
|
634 |
|
|
635 |
complexType.setAttributesType(XMLComplexType.CHOICE_TYPE); |
|
636 |
|
|
637 |
while (!end) |
|
638 |
{ |
|
639 |
switch(currentTag) |
|
640 |
{ |
|
641 |
case KXmlParser.START_TAG: |
|
642 |
/************************ |
|
643 |
* Etiqueta <Element> * |
|
644 |
************************/ |
|
645 |
if (getName().compareTo(CapabilitiesTags.ELEMENT)==0){ |
|
646 |
XMLElement element = new XMLElement(this); |
|
647 |
if (element != null){ |
|
648 |
complexType.addSubtypes(element); |
|
649 |
} |
|
650 |
} |
|
651 |
break; |
|
652 |
case KXmlParser.END_TAG: |
|
653 |
if (getName().compareTo(CapabilitiesTags.CHOICE) == 0) |
|
654 |
end = true; |
|
655 |
break; |
|
656 |
case KXmlParser.TEXT: |
|
657 |
break; |
|
658 |
} |
|
659 |
if (!end){ |
|
660 |
currentTag = next(); |
|
661 |
} |
|
662 |
} |
|
663 |
} |
|
664 |
|
|
572 | 665 |
/** |
573 | 666 |
* @return Returns the attributes. |
574 | 667 |
*/ |
Also available in: Unified diff