diff --git a/wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAStructElem.java b/wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAStructElem.java index e37bdcd4c..2d32ed6c5 100644 --- a/wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAStructElem.java +++ b/wcag-validation/src/main/java/org/verapdf/gf/model/impl/sa/GFSAStructElem.java @@ -170,9 +170,8 @@ protected void parseChildren() { } } else if (element instanceof PDOBJRDictionary) { COSObject obj = ((PDOBJRDictionary)element).getReferencedObject(); - if (obj != null && obj.getType() == COSObjType.COS_DICT && - GFSAAnnotation.LINK.equals(obj.getNameKeyStringValue(ASAtom.SUBTYPE))) { - getNode().addChild(new GFSAAnnotationNode(new PDAnnotation(obj))); + if (obj != null && obj.getType() == COSObjType.COS_DICT) { + getNode().addChild(new SemanticAnnot(new GFSAAnnotationNode(new PDAnnotation(obj)))); } } else if (element instanceof COSObject && ((COSObject)element).getType() == COSObjType.COS_INTEGER) { chunks.addAll(getChunks(getPageObjectNumber(), (((COSObject)element).getDirectBase()).getInteger())); diff --git a/wcag-validation/src/main/java/org/verapdf/gf/model/impl/serializer/NodeSerializer.java b/wcag-validation/src/main/java/org/verapdf/gf/model/impl/serializer/NodeSerializer.java index bdcaacdb3..043bbf57e 100644 --- a/wcag-validation/src/main/java/org/verapdf/gf/model/impl/serializer/NodeSerializer.java +++ b/wcag-validation/src/main/java/org/verapdf/gf/model/impl/serializer/NodeSerializer.java @@ -6,6 +6,7 @@ import org.verapdf.gf.model.impl.sa.*; import org.verapdf.wcag.algorithms.entities.IAttributesDictionary; import org.verapdf.wcag.algorithms.entities.INode; +import org.verapdf.wcag.algorithms.entities.SemanticAnnot; import java.io.IOException; import java.util.Objects; @@ -34,7 +35,7 @@ public void serialize(GFSAStructElem elem, JsonGenerator jsonGenerator, Serializ jsonGenerator.writeNumberField("rowSpan", AttributesDictionary.getRowSpan()); jsonGenerator.writeEndObject(); } - if (!elem.getChildren().isEmpty()) { + if (!elem.getChildren().isEmpty() || !elem.getNode().getChildren().isEmpty()) { jsonGenerator.writeFieldName("children"); jsonGenerator.writeStartArray(); for (Object child : elem.getChildren()) { @@ -49,8 +50,8 @@ public void serialize(GFSAStructElem elem, JsonGenerator jsonGenerator, Serializ } } for (INode child : elem.getNode().getChildren()) { - if (child instanceof GFSAAnnotationNode) { - jsonGenerator.writeObject(child); + if (child instanceof SemanticAnnot) { + jsonGenerator.writeObject(((SemanticAnnot)child).getAnnots().get(0)); } } jsonGenerator.writeEndArray();